import { http } from "@/utils/http";
import { baseUrlApi } from "./utils";
/** 系统管理-用户管理列表 */
export const getUserList = data => {
  return http.request("post", baseUrlApi("/user/pageList"), { data });
};
/** 系统管理-用户编辑 */
export const updateUserInfo = data => {
  return http.request("post", baseUrlApi("/user/updateUserInfo"), { data });
};
/** 获取系统管理-角色管理列表 */
export const getAllRoleList = data => {
  return http.request("post", baseUrlApi("/userRole/pageList"), { data });
};

/** 获取系统管理-角色列表 */
export const getRoleList = data => {
  return http.request("post", baseUrlApi("/userRole/pageList"), { data });
};

/** 获取系统管理-新增角色 */
export const addRole = data => {
  return http.request("post", baseUrlApi("/userRole/add"), { data });
};
/** 获取系统管理-编辑角色 */
export const updateRole = data => {
  return http.request("post", baseUrlApi("/userRole/update"), { data });
};
/** 获取系统管理-删除角色 */
export const delRole = params => {
  return http.request("get", baseUrlApi("/userRole/del"), { params });
};

/** 获取系统管理-菜单管理列表 */
export const getMenuList = () => {
  return http.request("get", baseUrlApi("/menu/list"));
};
/** 获取系统管理-菜单管理编辑 */
export const updateMenuInfo = data => {
  return http.request("post", baseUrlApi("/menu/updateMenu"), { data });
};
/** 获取系统管理-菜单管理添加 */
export const addMenuInfo = data => {
  return http.request("post", baseUrlApi("/menu/addMenu"), { data });
};
/** 获取系统管理-菜单管理删除 */
export const delMenuInfo = params => {
  return http.request("get", baseUrlApi("/menu/delMenu"), { params });
};

/** 获取角色管理-权限-菜单权限 */
export const getRoleMenu = params => {
  return http.request("get", baseUrlApi("/userRole/getRoleMenu"), { params });
};

/** 获取角色管理-权限-菜单权限-根据角色 id 查对应菜单 */
export const getRoleMenuIds = params => {
  return http.request("get", baseUrlApi("/userRole//getRoleMenuIds"), {
    params
  });
};

/** 获取角色管理-权限-菜单权限-根据角色 id 查对应菜单 */
export const updateRoleMenuIds = data => {
  return http.request("post", baseUrlApi("/userRole/addOrUpdatePermission"), {
    data
  });
};
